<template>
	
 	<div class="layui-layout layui-layout-admin" >
 	  <div class="adminnav1">	
        <Pagetop></Pagetop>
      </div>
      <div class="adminnav2">	
       	<Secondnav urlname="daili"></Secondnav>
      </div>
      
      <!-- 主体内容 -->
      <div class="layui-body kedou-admin" id="LAY_app_body app">
	    <div class="layadmin-tabsbody-item layui-show">
	    	<div class="pagelist">
	    		<div class="layui-card-body">
		      		<fieldset class="layui-elem-field layui-field-title">
					  <legend>代理商升级审核</legend>					 
					</fieldset>					
		       </div>		       		        
	    		<div class="pagetop">
	    			<Search :seadate="searchArr"></Search>			    	
		        </div>	      
		        <div class="layui-card-body">		        	
		        	<div class="buttop">
					    <button type="button" class="layui-btn  layui-btn-primary" @click="addData(1)">待审核1</button>
					    <button type="button" class="layui-btn  layui-btn-primary" @click="addData(2)">待补货/待充值2</button>
					    <button type="button" class="layui-btn  layui-btn-primary" @click="addData(3)">已通过3</button>
					    <button type="button" class="layui-btn  layui-btn-primary" @click="addData(4)">已拒绝/已取消4</button>
					    <button type="button" class="layui-btn  layui-btn-danger" @click="addData(5)">全部申请5</button>
					    <button type="button" class="layui-btn  layui-btn-normal" style="margin-left:470px;" @click="getset">代理升级设置</button>
					    <button type="button" class="layui-btn  layui-btn-normal" style="margin-left:20px;" @click="daoru">导出</button><!--620-->
					</div>
			        <Tables :fdate="pdate" :result="res" height="430" :totalCount="totalRows" :pageNumber="curindex" :fbtn="btn"></Tables>      			     
		        </div>		      
	        </div>
	    </div>
	  </div>  
	     
	</div>
</template>
<script>	
	import Pagetop from '../../common/pagetop.vue'
	import Secondnav from '../../common/secondnav.vue'
	import Tables from '../../common/tables.vue'
	import Search from '../../common/search.vue'
	export default {
	  name: 'sjlist',
	  components: {Pagetop,Secondnav,Tables,Search},	  
	  data () {
	    return {
	        pdate:[], //表头  	
	    	res:"", //内容
	    	totalRows:"",//总数量
	    	curindex:1, //页数
	    	btn:[],//按钮
	    	searchArr:[],//搜索
	    	isShow:false, 
	    	seapram:''   	
	    }
	  },
	  mounted(){ 	
	  	this.getdate();
     	this.getsearch();
	  },
	  methods: {	 	  
		getdate:function(){     	
    	var _this=this;    	    	
    	var url="/huanxinsong/commodity/chainstoregoodslistJson" //更换接口
    	if(_this.seapram){
    		var dates={
	    		pageSize:pageSize,
	    		pageNumber:this.curindex
	    	}
    		var res=_this.seapram;
    		for(var i=0;i<res.length;i++){
    			dates[res[i].key]=res[i].val;
    		}
    		
    	}else{
	    	var dates={
	    		pageSize:pageSize,
	    		pageNumber:this.curindex
	    	}
        }  		    	
        	//alert(url+"//"+JSON.stringify(dates))
//    	ajaxRequest(url,'GET','json',dates,function(ret,err){
      		//alert(url+"//"+JSON.stringify(ret))
	  		var arr=[];  		
		  	arr[0]=[ 
		       {field: 'a', title: '代理商名称',}
		      ,{field: 'a1', title: '代理商电话',}
		      ,{field: 'b', title: '申请前等级',}
		      ,{field: 'c', title: '申请前上级',}
		      ,{field: 'd', title: '申请后等级',}
		      ,{field: 'e', title: '申请后上级',}	
		      ,{field: 'f', title: '申请时间',}
		      ,{field: 'g', title: '状态',}
		      ,{field: 'h', title: '说明',}
		      ,{field: 'right',title: '操作', width:'120', fixed:'right',templet:function(d){ 
		         var str='<a class="layui-btn layui-btn-xs" lay-event="upgrade">升级条件</a>';		        		        
		         return str;
		      }}
		    ];	
			var res1=[]		   
		     res1=[{a:'掌1',a1:'13200000000',b:'c级-掌柜',c:'社1',d:'团1',e:'社1',f:'2020-1-1',g:'已通过',h:'自动审核'}]	    
		  		 
		  	_this.pdate=arr;		 
		  	_this.res=res1;//ret.content.result;
		  	_this.totalRows=ret.content.totalCount;
		  	_this.curindex=ret.content.pageNumber;		  	
//	    })	
    },     
     getsearch:function(){
    	var arr=[
    		{field: '', title: '手机号码',type: 'input'} 
 		];
    	this.searchArr=arr;
   	
    },
    page:function(index,obj){
    	//alert(JSON,stringify(obj))
    	this.curindex=index;
    	this.getdate();
    	
    }, 
    sousuo:function(pram){
    	//alert(JSON.stringify(pram))
    	this.seapram=pram;
    	this.res='';
    	this.totalRows='';
    	this.curindex=1;
    	this.getdate();
    },
    addData:function(is){ 
    	$('.layui-btn').removeClass('layui-btn-danger')   
    	$('.layui-btn').addClass('layui-btn-primary')    	
    	$(".layui-btn:eq('"+is+"')").addClass('layui-btn-danger')
    	alert('开发中')
       // this.$router.push({name:'dailiadd'})	
	},
	daoru:function(){
		alert('开发中')
	},
	getset:function(){//代理升级设置
		alert('开发中')
		return false;
		//this.$router.push({name:'sjset'})		
	},
	upgradeInfo:function(data){
		var _this = this;
		layer.open({
	        type:1
	        ,title: '升级条件'	        
	        ,content:'<div class="a" style="padding:40px 30px;">'
	                 +'<p style="padding-bottom:10px;">条件：升级条件一</p>'
					 +'<p>条件详情：累计直接邀请等级等于掌柜的代理30人；</p>'	        
	                 +'</div>'
	        ,btn:['取消']
	        ,yes:function (index, layero) {
	        	var text=$('.a').text();
	        	var shopId=localStorage.getItem("shopId");
	        	alert('开发中')
	        	if(text){
	        		var url = "/huanxinsong/group/save";  
	        		var date={
	        			shopId:shopId,
						name:val,
					}
	        		//alert(JSON.stringify(date))
					ajaxRequest(url,'GET','json',date,function(ret,err){
						layer.msg("操作成功")
						setTimeout(function(){
							_this.getdate();
							parent.layer.close(index);
						},2000)
					})	        		
	        	}
	        	
            } 
        }) 	
	},

	screens:function(){
		return screen();
	},	
  },
  updated:function(){
  	this.isShow = true;
	layui.use('form', function(){
	  var form = layui.form;
	  form.render();	 
	});
  },
}
</script>
<style scoped>

</style>
